package com.jingdun.sport.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jingdun.sport.bean.model.Withdrawal;
import com.jingdun.sport.dao.WithdrawalMapper;
import com.jingdun.sport.service.WithdrawalService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
@Slf4j
@AllArgsConstructor
public class WithdrawalServiceImpl extends ServiceImpl<WithdrawalMapper, Withdrawal> implements WithdrawalService {
    
    private WithdrawalMapper withdrawalMapper;
    
    public void addWithdrawal(Withdrawal withdrawal){
        withdrawalMapper.addWithdrawal(withdrawal);
    }
    
    public Withdrawal getWithdrawalDetail(@Param("params") Map<String, Object> m){
        return withdrawalMapper.getWithdrawalDetail(m);
    }
    
    public void updateWithdrawal(Withdrawal withdrawal){
        withdrawalMapper.updateWithdrawal(withdrawal);
    }
    
    public Page<Map<String, Object>> getPaginationWithdrawal(@Param("params") Map<String, Object> m){
        //新建分页
        Page<Map<String,Object>> page = new Page<Map<String,Object>>((long)m.get("current"), (long)m.get("size"));
        //返回结果
        page.setRecords(this.baseMapper.getPaginationWithdrawal(page, m));
        return page;
    }
}
